package j2024.j202412;

public class j1207 {
    public int lengthOfLongestSubstring(String s) {
        char[] ss = s.toCharArray();
        int[] hash = new int[128];
        int left = 0,right = 0;
        int len = 0;
        while (left<=right && right<ss.length) {
            hash[ss[right]]++;
            while(hash[ss[right]]>1){
                hash[ss[left++]]--;
            }
            len = Math.max(len,right-left+1);
            right++;
        }
        return len;
    }
}
